package com.zlm.design.strategy;

import java.util.function.IntPredicate;

/**
 * @author zlm
 * @date 2025/5/14
 */
public enum UserType {
    NORMAL(recharge -> recharge <= 100 && recharge > 0),
    SMALLR(recharge -> recharge > 100);

    private IntPredicate support;


    UserType(IntPredicate support){
        this.support = support;
    }

    public static UserType typeOf(int recharge){
        for (UserType userType : values()) {
            if (userType.support.test(recharge)) {
                return userType;
            }
        }
        return null;
    }
}
